import org.openqa.selenium.WebDriver;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import java.util.logging.Logger;


public class BaseTestClass {

    private WebDriver driver;
    protected Logger LOG = Logger.getLogger(getClass().getName());

    public BaseTestClass() {
        WebFactory factory = new WebFactory(driver);
        driver = factory.createNewDriver();
    }

    @BeforeTest(alwaysRun = true)
    public void before() {
        LOG.info("Test started");
    }

    @AfterTest(alwaysRun = true)
    public void after() {
        driver.quit();
        LOG.info("Driver closed :)");
    }

    public HomePage loadHomePage(String page) {
        driver.get(page);
        return new HomePage(driver);
    }
}
